@ninjainfosys/site-kit 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,7 @@ The package ships `.astro` and `.ts` source. The integration tells Vite to compi
37
37
 
38
38
  | Page | Routes | Turn off with |
39
39
  | --- | --- | --- |
40
- | `blog` | `/blog`, `/blog/[slug]`, `/blog/page/[page]`, `/blog/tag/[tag]` | `pages: { blog: false }` (a site whose blog keeps its earlier layout supplies its own blog pages and still uses the kit's Pager, PostList and Topics) |
40
+ | `blog` | `/blog`, `/blog/[slug]`, `/blog/page/[page]`, `/blog/tag/[tag]` | `pages: { blog: false }` (a site that needs a different blog supplies its own pages) |
41
41
  | `glossary` | `/glossary`, `/glossary/[slug]` | `pages: { glossary: false }` |
42
42
  | `og` | `/og/[...slug].png` | `pages: { og: false }` |
43
43
  | `rss` | `/rss.xml` | `pages: { rss: false }` |
@@ -72,9 +72,32 @@ A post whose `date` is after the build day (YYYY-MM-DD) is left out of every pro
72
72
 
73
73
  ## Post bodies
74
74
 
75
- - **Links to posts that do not ship.** In a build, a link to `/blog/<slug>` in a post or glossary body becomes plain text when that post is a draft or scheduled for later. Links to posts that do not exist are left as written. The dev server keeps every link.
76
- - **Tables.** Tables in blog posts are wrapped at build time in a bordered scroll box (`.table-scroll`). The header stays at the top and the first column at the left while scrolling sideways, rows are zebra-striped with a hover tint, and columns that are mostly numbers or prices get class `num` (right-aligned, no wrapping). Markdown outside `src/content/blog` is left alone. Glossary bodies are plain paragraphs and lists and have no tables.
77
- - **Updated date.** The post meta line shows "Updated" only when `updated` is a later day than `date`; structured data still uses `updated ?? date`.
75
+ What authors can write in a post's Markdown, and what the kit does with it:
76
+
77
+ | Write | You get |
78
+ | --- | --- |
79
+ | `> [!NOTE]` then the text | A panel with an info icon and the label "Note". |
80
+ | `> [!TIP]` | The same panel with a bulb and "Tip". |
81
+ | `> [!WARNING]` | A warm tinted panel with an alert icon and "Watch out". |
82
+ | `> [!STAT]`, then the number on the first line, then a caption | A large number (2rem, 600) with the caption under it. |
83
+ | `> text` | A quote: larger text with a quote mark, no stripe. |
84
+ | `1. 2. 3.` | Steps with the number in a 28px circle. |
85
+ | `- item` | Bullets in the accent colour. |
86
+ | A Markdown table | A bordered box that scrolls sideways. The header and first column stay in view, rows are striped, and columns of numbers and prices are right-aligned. |
87
+ | `![alt](file "caption")` alone in a paragraph | A figure with a visible caption. On wide screens it reaches into the contents rail's space. |
88
+ | `[text](/blog/other-post)` | A link, unless that post is a draft or scheduled for later. Then plain text. The same goes for `/glossary/<term>` links to terms not released yet. |
89
+
90
+ On every post page the kit also adds: a "#" link on hover or focus beside each H2, a "Copy link" button by the date line, a thin reading-progress bar (hidden under reduced motion) and the "Questions people ask" accordion with the first answer open. "Updated" shows only when `updated` is a later day than `date`. Callouts, tables and the unlinking apply only to files in `src/content/blog`.
91
+
92
+ The article styles use only the site's tokens: `--canvas --surface --subtle --line --ink --ink-muted --link --mark --warn-bg --warn-ink --font-sans --font-display --font-mono --font-serif --radius-panel --radius-control`. `--mark` is the accent for bullets and the progress bar. `--warn-bg` and `--warn-ink` are the warning panel (keep the text at AA contrast). A site that is strictly black and white points them at its greys.
93
+
94
+ ## Glossary
95
+
96
+ `/glossary` shows the term count, a search box that filters as you type (term, full name, aliases and definition; the full list shows without JavaScript), topic chips when terms carry `topic`, a sticky A-Z bar that marks the letter in view, the terms with `sections` first as "In-depth guides", and every term as a card under its letter.
97
+
98
+ `/glossary/<slug>` uses the blog post layout: breadcrumbs (Glossary, then the letter), the title, a meta line (aliases from `aka`, reading time, `updated` when set), the quotable definition with a "Copy definition" button, the article with an "On this page" rail built from `sections` and `faq`, related terms as cards, guides as story cards, and previous and next term. The article styles, callout and link rules of posts apply. DefinedTerm, DefinedTermSet, TechArticle, FAQPage and BreadcrumbList data are unchanged apart from the letter step in the breadcrumb.
99
+
100
+ Term fields the kit reads: `slug term full short body related product aka published updated title description sections faq` and the optional `topic`. A term whose `published` date is in the future stays out of the build. `kit.glossary.heading` sets the front's h1 (default "Glossary").
78
101
 
79
102
  ## Commands
80
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninjainfosys/site-kit",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "Shared blog, glossary, SEO, layout and build tooling for the Ninja Infosys Astro marketing sites.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/contract.ts CHANGED
@@ -168,6 +168,8 @@ export interface KitConfig {
168
168
  cta: { heading: string; actions: { href: string; label: string; class: string }[] };
169
169
  og: OgConfig;
170
170
  glossary: {
171
+ /** The h1 of the glossary front; default 'Glossary'. */
172
+ heading?: string;
171
173
  name: string;
172
174
  ogTitle: string;
173
175
  indexTitle: string;
@@ -4,7 +4,7 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { join } from 'node:path';
6
6
  import { rehypeFigures } from './lib/rehype-figures.mjs';
7
- import { rehypeTables, rehypeUnlinkHidden } from './lib/rehype-posts.mjs';
7
+ import { rehypeCallouts, rehypeTables, rehypeUnlinkHidden } from './lib/rehype-posts.mjs';
8
8
 
9
9
  const PACKAGE = '@ninjainfosys/site-kit';
10
10
  const BLOG_IMAGES = 'virtual:site-kit/blog-images';
@@ -27,7 +27,16 @@ function postStatus(root, dev) {
27
27
  const showScheduled = process.env.SHOW_SCHEDULED === '1';
28
28
  const shipping = [];
29
29
  const hidden = [];
30
- if (!existsSync(dir)) return { shipping, hidden };
30
+ const hiddenTerms = [];
31
+ const terms = join(root, 'src/data/glossary/terms');
32
+ if (!dev && existsSync(terms)) {
33
+ for (const f of readdirSync(terms).filter((x) => x.endsWith('.ts'))) {
34
+ const src = readFileSync(join(terms, f), 'utf8');
35
+ const published = src.match(/\bpublished:\s*['"](\d{4}-\d{2}-\d{2})['"]/)?.[1];
36
+ if (published && published > today && !showScheduled) hiddenTerms.push(src.match(/\bslug:\s*['"]([^'"]+)['"]/)?.[1] ?? f.replace(/\.ts$/, ''));
37
+ }
38
+ }
39
+ if (!existsSync(dir)) return { shipping, hidden, hiddenTerms };
31
40
  for (const f of readdirSync(dir).filter((x) => x.endsWith('.md'))) {
32
41
  const fm = readFileSync(join(dir, f), 'utf8').match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1] ?? '';
33
42
  const date = fm.match(/^date:\s*["']?(\d{4}-\d{2}-\d{2})/m)?.[1];
@@ -35,7 +44,7 @@ function postStatus(root, dev) {
35
44
  const scheduled = !showScheduled && !!date && date > today;
36
45
  (!dev && (draft || scheduled) ? hidden : shipping).push(f.replace(/\.md$/, ''));
37
46
  }
38
- return { shipping, hidden };
47
+ return { shipping, hidden, hiddenTerms };
39
48
  }
40
49
 
41
50
  function blogImages(root, dev) {
@@ -87,7 +96,7 @@ export default function siteKit(options = {}) {
87
96
  const root = fileURLToPath(config.root);
88
97
  const status = postStatus(root, command === 'dev');
89
98
  updateConfig({
90
- markdown: { rehypePlugins: [rehypeFigures, rehypeTables, [rehypeUnlinkHidden, { hidden: status.hidden }]] },
99
+ markdown: { rehypePlugins: [rehypeFigures, rehypeCallouts, rehypeTables, [rehypeUnlinkHidden, { hidden: status.hidden, hiddenTerms: status.hiddenTerms }]] },
91
100
  vite: {
92
101
  plugins: [
93
102
  {
@@ -0,0 +1,64 @@
1
+ // Browser behaviour shared by the blog post and the glossary term page: section
2
+ // links on H2s, "Copy link" buttons, a reading-progress bar and the contents
3
+ // rail that marks the section being read.
4
+ export function initArticle() {
5
+ // A link icon beside each H2 copies that section's address.
6
+ document.querySelectorAll<HTMLElement>('.article-body h2[id]').forEach((h) => {
7
+ const a = document.createElement('a');
8
+ a.className = 'anchor';
9
+ a.href = `#${h.id}`;
10
+ a.textContent = '#';
11
+ a.setAttribute('aria-label', `Link to the section ${h.textContent}`);
12
+ a.addEventListener('click', () => { navigator.clipboard?.writeText(`${location.origin}${location.pathname}#${h.id}`).catch(() => {}); });
13
+ h.append(a);
14
+ });
15
+ // Copy the post's address; the button says so for a moment.
16
+ document.querySelector<HTMLButtonElement>('[data-copy-link]')?.addEventListener('click', (e) => {
17
+ const b = e.currentTarget as HTMLButtonElement;
18
+ navigator.clipboard?.writeText(location.href.split('#')[0]).then(() => {
19
+ b.textContent = 'Copied';
20
+ setTimeout(() => { b.textContent = 'Copy link'; }, 2000);
21
+ }).catch(() => {});
22
+ });
23
+ // Reading progress: how far down the article the page has scrolled.
24
+ const bar = document.querySelector<HTMLElement>('.read-progress i');
25
+ const article = document.querySelector<HTMLElement>('.article-body');
26
+ if (bar && article && !matchMedia('(prefers-reduced-motion: reduce)').matches) {
27
+ let tick = 0;
28
+ const update = () => {
29
+ tick = 0;
30
+ const box = article.getBoundingClientRect();
31
+ const total = box.height - innerHeight * 0.5;
32
+ bar.style.setProperty('--p', String(Math.min(1, Math.max(0, (innerHeight * 0.25 - box.top) / total))));
33
+ };
34
+ addEventListener('scroll', () => { if (!tick) tick = requestAnimationFrame(update); }, { passive: true });
35
+ update();
36
+ }
37
+ // The side contents list marks the section being read.
38
+ const links = new Map([...document.querySelectorAll<HTMLAnchorElement>('[data-toc]')].map((a) => [a.dataset.toc!, a]));
39
+ if (links.size) {
40
+ const seen = new Set<string>();
41
+ const mark = () => {
42
+ const order = [...links.keys()];
43
+ const current = order.filter((id) => seen.has(id)).at(0) ?? null;
44
+ links.forEach((a, id) => a.toggleAttribute('aria-current', id === current));
45
+ };
46
+ const io = new IntersectionObserver((entries) => {
47
+ entries.forEach((e) => (e.isIntersecting ? seen.add(e.target.id) : seen.delete(e.target.id)));
48
+ mark();
49
+ }, { rootMargin: '-96px 0px -60% 0px' });
50
+ links.forEach((_, id) => { const h = document.getElementById(id); if (h) io.observe(h); });
51
+ }
52
+ // Closing the mobile contents list after a jump keeps the text in view.
53
+ document.querySelectorAll('.toc-inline a').forEach((a) => a.addEventListener('click', () => a.closest('details')?.removeAttribute('open')));
54
+ // "Copy definition": copies the text in the button's data-copy attribute.
55
+ document.querySelectorAll<HTMLButtonElement>('[data-copy]').forEach((b) => {
56
+ const label = b.textContent;
57
+ b.addEventListener('click', () => {
58
+ navigator.clipboard?.writeText(b.dataset.copy ?? '').then(() => {
59
+ b.textContent = 'Copied';
60
+ setTimeout(() => { b.textContent = label; }, 2000);
61
+ }).catch(() => {});
62
+ });
63
+ });
64
+ }
@@ -8,6 +8,8 @@ export interface Term {
8
8
  related: string[];
9
9
  /** Product page this term leads to. */
10
10
  product?: string;
11
+ /** Group for the index's topic filter ("Cameras", "Storage"). Leave out when terms are not grouped. */
12
+ topic?: string;
11
13
  /** Other names people search for, marked up as alternate names. */
12
14
  aka?: string[];
13
15
  /** Day the term goes live (YYYY-MM-DD). Builds before this day leave it out; no date means always live. */
@@ -6,7 +6,8 @@
6
6
  //
7
7
  // rehypeUnlinkHidden turns a link to /blog/<slug> into plain text when that
8
8
  // post is a draft or scheduled for later, so a shipping page never links to a
9
- // page that is not built. Links to posts that do not exist are left alone.
9
+ // page that is not built. The same goes for a link to a glossary term that is
10
+ // not released yet. Links to pages that do not exist are left alone.
10
11
 
11
12
  const NUM = /^[~≈<>+]?\s*(?:Rs\.?|NPR|US\$|\$)?\s*\d[\d,.]*\s*(?:%|[kKmM]\b|MB|GB|TB|Mbps|MP|days?|hrs?|months?|years?)?(?:\s*(?:–|-|to)\s*(?:Rs\.?|NPR|\$)?\s*\d[\d,.]*\s*(?:%|[kKmM]\b|MB|GB|TB|MP|days?)?)?(?:\s*\/\s*\w+)?$/i;
12
13
 
@@ -54,10 +55,10 @@ export function rehypeTables() {
54
55
  }
55
56
 
56
57
  export function rehypeUnlinkHidden(options = {}) {
57
- const hidden = new Set(options.hidden ?? []);
58
+ const hidden = new Set([...(options.hidden ?? []).map((s) => `blog/${s}`), ...(options.hiddenTerms ?? []).map((s) => `glossary/${s}`)]);
58
59
  const slugOf = (href) => {
59
- const m = String(href ?? '').match(/^(?:https?:\/\/[^/]+)?\/blog\/([^/?#]+)\/?(?:[?#].*)?$/);
60
- return m ? m[1] : null;
60
+ const m = String(href ?? '').match(/^(?:https?:\/\/[^/]+)?\/(blog|glossary)\/([^/?#]+)\/?(?:[?#].*)?$/);
61
+ return m ? `${m[1]}/${m[2]}` : null;
61
62
  };
62
63
  const walk = (node) => {
63
64
  if (!node.children) return;
@@ -69,3 +70,64 @@ export function rehypeUnlinkHidden(options = {}) {
69
70
  };
70
71
  return (tree) => walk(tree);
71
72
  }
73
+
74
+ // Callouts from Markdown, in GitHub's alert syntax:
75
+ //
76
+ // > [!NOTE] > [!TIP] > [!WARNING] > [!STAT]
77
+ // > text
78
+ //
79
+ // A blockquote that starts with one of these markers becomes
80
+ // <aside class="callout callout-note">. STAT shows its first line as a large
81
+ // number and the rest as a caption.
82
+ const ICONS = {
83
+ note: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
84
+ tip: '<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',
85
+ warning: '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
86
+ };
87
+ const LABELS = { note: 'Note', tip: 'Tip', warning: 'Watch out' };
88
+ const el = (tagName, properties = {}, children = []) => ({ type: 'element', tagName, properties, children });
89
+ const camel = (k) => k.replace(/-(\w)/g, (_, c) => c.toUpperCase());
90
+ // The icon strings above as hast nodes (no raw HTML, so any Markdown pipeline accepts them).
91
+ const icon = (kind) => el('svg', { viewBox: '0 0 24 24', width: 18, height: 18, fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round', ariaHidden: 'true' },
92
+ [...ICONS[kind].matchAll(/<(\w+)([^>]*)\/>/g)].map((m) => el(m[1], Object.fromEntries([...m[2].matchAll(/([\w-]+)="([^"]*)"/g)].map((a) => [camel(a[1]), a[2]])))));
93
+
94
+ export function rehypeCallouts() {
95
+ const walk = (node) => {
96
+ if (!node.children) return;
97
+ node.children = node.children.map((child) => {
98
+ if (isEl(child, 'blockquote')) {
99
+ const made = callout(child);
100
+ if (made) return made;
101
+ }
102
+ walk(child);
103
+ return child;
104
+ });
105
+ };
106
+ function callout(bq) {
107
+ const kids = bq.children.filter((k) => !(k.type === 'text' && !k.value.trim()));
108
+ const first = kids[0];
109
+ if (!first || !isEl(first, 'p')) return null;
110
+ const lead = first.children?.[0];
111
+ const m = lead?.type === 'text' && lead.value.match(/^\s*\[!(NOTE|TIP|WARNING|STAT)\][ \t]*\r?\n?/i);
112
+ if (!m) return null;
113
+ const kind = m[1].toLowerCase();
114
+ const p = { ...first, children: [{ ...lead, value: lead.value.slice(m[0].length) }, ...first.children.slice(1)] };
115
+ const rest = kids.slice(1);
116
+ if (kind === 'stat') {
117
+ const text = p.children[0]?.type === 'text' ? p.children[0].value : '';
118
+ const nl = text.indexOf('\n');
119
+ const number = (nl === -1 ? text : text.slice(0, nl)).trim();
120
+ const after = nl === -1 ? [] : [{ type: 'text', value: text.slice(nl + 1) }, ...p.children.slice(1)];
121
+ const caption = [...(after.length && textOf({ children: after }).trim() ? [el('p', {}, after)] : []), ...rest];
122
+ walk({ children: caption });
123
+ return el('aside', { className: ['callout', 'callout-stat'] }, [el('p', { className: ['stat-number'] }, [{ type: 'text', value: number }]), el('div', { className: ['stat-caption'] }, caption)]);
124
+ }
125
+ const body = [...(textOf(p).trim() ? [p] : []), ...rest];
126
+ walk({ children: body });
127
+ return el('aside', { className: ['callout', `callout-${kind}`] }, [
128
+ el('p', { className: ['callout-title'] }, [icon(kind), el('span', {}, [{ type: 'text', value: LABELS[kind] }])]),
129
+ ...body,
130
+ ]);
131
+ }
132
+ return (tree, file) => { if (/[\\/]content[\\/]blog[\\/]/.test(String(file?.path ?? ''))) walk(tree); };
133
+ }
package/src/lib/seo.ts CHANGED
@@ -76,7 +76,7 @@ export function websiteJsonLd() {
76
76
  };
77
77
  }
78
78
 
79
- export function breadcrumbJsonLd(items: { name: string; path: string }[]) {
79
+ export function breadcrumbJsonLd(items: { name: string; path: string; url?: string }[]) {
80
80
  const all = [{ name: 'Home', path: '/' }, ...items];
81
81
  return {
82
82
  '@context': 'https://schema.org',
@@ -85,7 +85,7 @@ export function breadcrumbJsonLd(items: { name: string; path: string }[]) {
85
85
  '@type': 'ListItem',
86
86
  position: i + 1,
87
87
  name: it.name,
88
- item: canonicalFor(it.path),
88
+ item: it.url ?? canonicalFor(it.path),
89
89
  })),
90
90
  };
91
91
  }
@@ -2,6 +2,8 @@
2
2
  import ChevronDown from '@lucide/astro/icons/chevron-down';
3
3
  import { render } from 'astro:content';
4
4
  import blogImages from 'virtual:site-kit/blog-images';
5
+ import '../../styles/article.css';
6
+ import '../../styles/article-layout.css';
5
7
  import { Image, getImage } from 'astro:assets';
6
8
  import { LICENCES } from '../../lib/blog-schema';
7
9
  import Base from '@site/layouts/Base.astro';
@@ -66,6 +68,7 @@ const readNext = (next.length ? next : all.filter((p) => p.id !== post.id)).slic
66
68
  ...imageObjects,
67
69
  ]}
68
70
  >
71
+ <div class="read-progress" aria-hidden="true"><i></i></div>
69
72
  <article class="post">
70
73
  <header class="wrap head">
71
74
  <nav class="crumbs" aria-label="Breadcrumb" data-enter>
@@ -79,6 +82,7 @@ const readNext = (next.length ? next : all.filter((p) => p.id !== post.id)).slic
79
82
  <time datetime={d.date.toISOString()}>{fmtDate(d.date)}</time>
80
83
  {d.updated && d.updated.toISOString().slice(0, 10) > d.date.toISOString().slice(0, 10) && <> · Updated <time datetime={d.updated.toISOString()}>{fmtDate(d.updated)}</time></>}
81
84
  <> · {minutes} min read</>
85
+ <button type="button" class="copy-link no-print" data-copy-link>Copy link</button>
82
86
  {d.draft && <span class="draft"> · Draft, not published</span>}
83
87
  </p>
84
88
  {d.cover && (
@@ -101,12 +105,12 @@ const readNext = (next.length ? next : all.filter((p) => p.id !== post.id)).slic
101
105
  <ol>{toc.map((h) => <li><a href={`#${h.slug}`}>{h.text}</a></li>)}</ol>
102
106
  </details>
103
107
  )}
104
- <div class="prose body" data-enter>
108
+ <div class="prose body article-body" data-enter>
105
109
  <Content />
106
110
  {(d.faq ?? []).length > 0 && (
107
111
  <section class="post-faq" aria-labelledby="faq-h">
108
112
  <h2 id="faq-h">Questions people ask</h2>
109
- {(d.faq ?? []).map((f) => <><h3>{f.q}</h3><p>{f.a}</p></>)}
113
+ {(d.faq ?? []).map((f, i) => <details open={i === 0}><summary>{f.q}</summary><p>{f.a}</p></details>)}
110
114
  </section>
111
115
  )}
112
116
  </div>
@@ -154,104 +158,21 @@ const readNext = (next.length ? next : all.filter((p) => p.id !== post.id)).slic
154
158
  </Base>
155
159
 
156
160
  <script>
157
- // The side contents list marks the section being read.
158
- const links = new Map([...document.querySelectorAll<HTMLAnchorElement>('[data-toc]')].map((a) => [a.dataset.toc!, a]));
159
- if (links.size) {
160
- const seen = new Set<string>();
161
- const mark = () => {
162
- const order = [...links.keys()];
163
- const current = order.filter((id) => seen.has(id)).at(0) ?? null;
164
- links.forEach((a, id) => a.toggleAttribute('aria-current', id === current));
165
- };
166
- const io = new IntersectionObserver((entries) => {
167
- entries.forEach((e) => (e.isIntersecting ? seen.add(e.target.id) : seen.delete(e.target.id)));
168
- mark();
169
- }, { rootMargin: '-96px 0px -60% 0px' });
170
- links.forEach((_, id) => { const h = document.getElementById(id); if (h) io.observe(h); });
171
- }
172
- // Closing the mobile contents list after a jump keeps the text in view.
173
- document.querySelectorAll('.toc-inline a').forEach((a) => a.addEventListener('click', () => a.closest('details')?.removeAttribute('open')));
161
+ import { initArticle } from '../../lib/article-client';
162
+ initArticle();
174
163
  </script>
175
164
 
176
165
 
177
166
  <style>
178
- /* Reading layout: one text column (about 68 characters a line) and, on wide
179
- screens, a sticky "On this page" rail. Phones get the same order with a
180
- tap-to-open contents list. */
181
- .post { padding-block: var(--space-6) var(--space-9); }
182
- /* Breadcrumb trail: section and topic, the title follows as the heading. */
183
- .crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); list-style: none; margin: 0; padding: 0; font-size: 14px; }
184
- .crumbs li { display: inline-flex; align-items: center; gap: var(--space-2); }
185
- .crumbs li + li::before { content: '›'; color: var(--ink-muted); }
186
- .crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-muted); text-decoration: none; }
187
- .crumbs a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
188
- .crumbs li:last-child a { color: var(--link); font-weight: 500; }
189
- .title { margin: var(--space-4) 0 var(--space-3); max-width: 26ch; font-weight: 600; font-size: clamp(1.875rem, 1.3rem + 2.4vw, 3.25rem); line-height: 1.12; text-wrap: balance; overflow-wrap: anywhere; }
190
- .meta { margin: 0 0 var(--space-6); font-size: 15px; color: var(--ink-muted); }
191
- .draft { color: var(--error); }
192
167
  /* Header, cover and text share the page's left edge; the cover spans text and rail. */
193
168
  .cover { margin: 0 0 var(--space-7); }
194
169
  .cover :global(img) { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-panel); background: var(--surface); }
195
-
196
- .grid { display: grid; grid-template-columns: minmax(0, 680px) 240px; justify-content: space-between; gap: var(--space-9); }
197
- .col { min-width: 0; }
198
-
199
170
  /* Key takeaways: a light list between two rules, no box. */
200
171
  .takeaways { margin: 0 0 var(--space-6); padding: var(--space-5) 0; border-block: 1px solid var(--line); }
201
172
  .takeaways h2 { margin: 0 0 var(--space-3); font-size: 1rem; line-height: 1.3; }
202
173
  .takeaways ul { margin: 0; padding-left: 1.2em; display: grid; gap: var(--space-2); }
203
174
  .takeaways li { font-size: 1.0625rem; line-height: 1.6; padding-left: 0.2em; }
204
- .takeaways li::marker { color: var(--lime); font-size: 1.1em; }
205
-
206
- /* Body text: serif, 18px, comfortable but not airy. */
207
- .body { max-width: none; font-size: 1.0625rem; line-height: 1.7; }
208
- .body :global(p), .body :global(ul), .body :global(ol) { margin: 0 0 1.1em; }
209
- .body :global(li + li) { margin-top: 0.35em; }
210
- .body :global(h2) { font-weight: 600; font-size: 1.5rem; line-height: 1.25; margin: 1.8em 0 0.6em; scroll-margin-top: 104px; }
211
- .body :global(h3) { font-weight: 600; font-size: 1.1875rem; line-height: 1.3; margin: 1.5em 0 0.4em; scroll-margin-top: 104px; }
212
-
213
- /* Tables: a bordered box that scrolls sideways, a header and first column that stay in view. */
214
- .body :global(.table-scroll) { overflow-x: auto; margin: 1.6em 0; border: 1px solid var(--line); border-radius: var(--radius-panel); }
215
- .body :global(table) { width: 100%; border-collapse: separate; border-spacing: 0; font-family: var(--font-sans); font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; }
216
- .body :global(th), .body :global(td) { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
217
- .body :global(th) { position: sticky; top: 0; z-index: 1; background: var(--surface); color: var(--ink); font-weight: 600; }
218
- .body :global(td) { background: var(--canvas); }
219
- .body :global(tbody tr:nth-child(even) td) { background: color-mix(in srgb, var(--surface) 50%, var(--canvas)); }
220
- .body :global(tbody tr:hover td) { background: var(--subtle); }
221
- .body :global(tbody tr:last-child td) { border-bottom: 0; }
222
- .body :global(th:first-child), .body :global(td:first-child) { position: sticky; left: 0; }
223
- .body :global(th:first-child) { z-index: 2; }
224
- .body :global(td:first-child) { font-weight: 500; }
225
- .body :global(th.num), .body :global(td.num) { text-align: right; white-space: nowrap; }
226
- .body :global(td a), .body :global(th a) { color: var(--link); }
227
- @media (max-width: 599px) {
228
- .body :global(table) { font-size: 14px; }
229
- .body :global(th), .body :global(td) { padding: 8px 12px; }
230
- }
231
- .body :global(figure) { margin: 1.6em 0; }
232
- .body :global(figure img), .body :global(img) { display: block; width: 100%; height: auto; margin: 0; border-radius: var(--radius-panel); background: var(--surface); }
233
- .body :global(figcaption) { margin-top: var(--space-2); font-size: 14px; line-height: 1.45; color: var(--ink-muted); }
234
-
235
- /* Contents on the right, sticky, current section in ink. */
236
- .rail { position: relative; }
237
- .toc { position: sticky; top: 104px; max-height: calc(100vh - 128px); overflow-y: auto; }
238
- .toc h2, .toc-inline summary { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 var(--space-3); }
239
- .toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
240
- .toc a { display: block; margin-left: -1px; padding: 7px 0 7px var(--space-4); border-left: 2px solid transparent; color: var(--ink-muted); font-size: 14px; line-height: 1.45; text-decoration: none; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
241
- .toc a:hover { color: var(--ink); }
242
- .toc a[aria-current] { color: var(--ink); font-weight: 500; border-left-color: var(--lime); }
243
-
244
- /* Tablet and phone: no rail; contents fold into a list under the takeaways. */
245
- .toc-inline { display: none; margin: 0 0 var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-panel); }
246
- .toc-inline summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin: 0; padding: 0 var(--space-4); cursor: pointer; list-style: none; }
247
- .toc-inline summary::-webkit-details-marker { display: none; }
248
- .toc-inline summary :global(svg) { transition: transform var(--fast) var(--ease); }
249
- .toc-inline[open] summary :global(svg) { transform: rotate(180deg); }
250
- .toc-inline ol { list-style: none; margin: 0; padding: 0 var(--space-4) var(--space-2); }
251
- .toc-inline li + li { border-top: 1px solid var(--line); }
252
- .toc-inline a { display: flex; align-items: center; min-height: 44px; padding-block: var(--space-2); color: var(--ink); font-size: 15px; line-height: 1.4; text-decoration: none; }
253
- .toc-inline a:hover { color: var(--link); }
254
-
175
+ .takeaways li::marker { color: var(--mark); font-size: 1.1em; }
255
176
  .credits { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; color: var(--ink-muted); }
256
177
  .credits h2 { font-size: 15px; margin: 0 0 var(--space-2); color: var(--ink); }
257
178
  .credits ul { margin: 0; padding-left: var(--space-5); }
@@ -267,19 +188,8 @@ const readNext = (next.length ? next : all.filter((p) => p.id !== post.id)).slic
267
188
  .next a:hover span { color: var(--link); }
268
189
  .next time { font-size: 14px; color: var(--ink-muted); }
269
190
 
270
- @media (max-width: 1099px) {
271
- .grid { grid-template-columns: minmax(0, 680px); gap: 0; }
272
- .rail { display: none; }
273
- .toc-inline { display: block; }
274
- }
275
191
  @media (max-width: 599px) {
276
- .post { padding-top: var(--space-4); }
277
192
  .cover { margin: 0 calc(-1 * var(--gutter)) var(--space-6); }
278
193
  .cover :global(img) { border-radius: 0; aspect-ratio: 3 / 2; }
279
- .body { font-size: 1rem; line-height: 1.7; }
280
- .body :global(h2) { font-size: 1.3125rem; }
281
- .body :global(figure) { margin: 1.4em calc(-1 * var(--gutter)); }
282
- .body :global(figure img) { border-radius: 0; }
283
- .body :global(figcaption) { padding-inline: var(--gutter); }
284
194
  }
285
195
  </style>
@@ -1,19 +1,31 @@
1
1
  ---
2
+ // One glossary term, laid out like a blog post: breadcrumbs, title, meta line,
3
+ // the quotable definition, the article with a contents rail, related terms as
4
+ // cards, previous and next term, and the guides that cover it.
5
+ import ChevronDown from '@lucide/astro/icons/chevron-down';
6
+ import ArrowLeft from '@lucide/astro/icons/arrow-left';
7
+ import ArrowRight from '@lucide/astro/icons/arrow-right';
2
8
  import Base from '@site/layouts/Base.astro';
3
9
  import Related from '../../components/site/Related.astro';
4
10
  import CtaBand from '../../components/site/CtaBand.astro';
5
- import ArrowLeft from '@lucide/astro/icons/arrow-left';
11
+ import Story from '../../components/blog/Story.astro';
6
12
  import { glossary, termBySlug, type Term } from '../../lib/glossary';
7
13
  import { productLink, productTags } from '@site/data/links';
8
14
  import { posts } from '../../lib/posts';
15
+ import { SITE_URL } from '../../config';
9
16
  import hiddenPosts from 'virtual:site-kit/hidden-posts';
10
17
  import { breadcrumbJsonLd, definedTermJsonLd, faqJsonLd, termArticleJsonLd } from '../../lib/seo';
18
+ import '../../styles/article.css';
19
+ import '../../styles/article-layout.css';
11
20
 
12
21
  export function getStaticPaths() {
13
- return glossary.map((t) => ({ params: { slug: t.slug }, props: { t } }));
22
+ const sorted = [...glossary].sort((a, b) => a.term.localeCompare(b.term));
23
+ return sorted.map((t, i) => ({ params: { slug: t.slug }, props: { t, prev: sorted[i - 1] ?? null, next: sorted[i + 1] ?? null } }));
14
24
  }
15
- const { t } = Astro.props as { t: Term };
25
+ const { t, prev, next } = Astro.props as { t: Term; prev: Term | null; next: Term | null };
16
26
  const path = `/glossary/${t.slug}`;
27
+ const letter = /^[A-Za-z]/.test(t.term) ? t.term[0].toUpperCase() : '#';
28
+ const letterId = `letter-${letter === '#' ? 'num' : letter.toLowerCase()}`;
17
29
  const heading = t.full ? `What is ${t.term} (${t.full})?` : `What is ${/^[A-Z]{2,}/.test(t.term) ? t.term : `a ${t.term.toLowerCase()}`}?`;
18
30
  const related = t.related.map(termBySlug).filter((x): x is Term => !!x);
19
31
  const product = t.product ? productLink(t.product) : null;
@@ -27,11 +39,15 @@ const description = t.description ?? (t.short.length <= 160 ? t.short : `${t.sho
27
39
  const strip = (x: string) => x.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
28
40
  const words = [t.short, ...t.body, ...sections.flatMap((x) => [x.h, ...x.p, ...(x.list ?? [])]), ...(t.faq ?? []).flatMap((f) => [f.q, f.a])]
29
41
  .map(strip).join(' ').split(/\s+/).length;
42
+ const minutes = Math.max(1, Math.round(words / 220));
43
+ const fmt = (d: string) => new Date(d).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' });
30
44
  // Copy is ours; escape it, then turn [text](/path) into internal links.
31
45
  const esc = (x: string) => x.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
32
46
  // A link to a glossary term that is not live yet, or to a post that is not built, renders as plain text.
33
47
  const md = (x: string) => esc(x).replace(/\[([^\]]+)\]\((\/[^)\s]*)\)/g, (_, text, href) =>
34
48
  (href.startsWith('/glossary/') && !termBySlug(href.slice(10).split('#')[0])) || (href.startsWith('/blog/') && hiddenPosts.includes(href.slice(6).split(/[#?]/)[0].replace(/\/$/, ''))) ? text : `<a href="${href}">${text}</a>`);
49
+ const toc = [...sections.map((x) => ({ id: x.id, h: x.h })), ...(t.faq?.length ? [{ id: 'faq', h: 'Questions people ask' }] : [])];
50
+ const hasToc = toc.length >= 3;
35
51
  ---
36
52
  <Base
37
53
  title={title}
@@ -41,86 +57,123 @@ const md = (x: string) => esc(x).replace(/\[([^\]]+)\]\((\/[^)\s]*)\)/g, (_, tex
41
57
  definedTermJsonLd(t),
42
58
  ...(sections.length && t.updated ? [termArticleJsonLd({ slug: t.slug, term: t.term, title, description, published: t.published ?? t.updated, updated: t.updated, sections, words })] : []),
43
59
  faqJsonLd(faq.map((f) => ({ q: f.q, a: strip(f.a) }))),
44
- breadcrumbJsonLd([{ name: 'Glossary', path: '/glossary' }, { name: t.term, path }]),
60
+ breadcrumbJsonLd([{ name: 'Glossary', path: '/glossary' }, { name: letter, path: '/glossary', url: `${SITE_URL}/glossary#${letterId}` }, { name: t.term, path }]),
45
61
  ]}
46
62
  >
47
- <article class="term">
48
- <div class="wrap">
63
+ <div class="read-progress" aria-hidden="true"><i></i></div>
64
+ <article class="post">
65
+ <header class="wrap head">
66
+ <nav class="crumbs" aria-label="Breadcrumb" data-enter>
67
+ <ol>
68
+ <li><a href="/glossary">Glossary</a></li>
69
+ <li><a href={`/glossary#${letterId}`}>{letter}</a></li>
70
+ </ol>
71
+ </nav>
72
+ <h1 class="title" data-enter>{heading}</h1>
73
+ <p class="meta" data-enter>
74
+ {t.aka?.length ? <>Also called: {t.aka.join(', ')} · </> : null}{minutes} min read{t.updated && <> · Updated <time datetime={t.updated}>{fmt(t.updated)}</time></>}
75
+ </p>
76
+ </header>
77
+ <div class="wrap grid">
49
78
  <div class="col">
50
- <a class="back" href="/glossary" data-enter><ArrowLeft size={18} stroke-width={2} aria-hidden="true" /> Glossary</a>
51
- <h1 data-enter>{heading}</h1>
52
- <p class="def" data-enter><dfn>{t.term}</dfn>{t.short.slice(t.term.length)}</p>
53
- <div class="prose body" data-enter>
54
- {t.body.map((p) => <p set:html={md(p)} />)}
79
+ <div class="def" data-enter>
80
+ <p><dfn>{t.term}</dfn>{t.short.slice(t.term.length)}</p>
81
+ <button type="button" class="copy-def" data-copy={t.short}>Copy definition</button>
55
82
  </div>
56
- {sections.length > 0 && (
57
- <nav class="toc" aria-label="On this page" data-enter>
58
- <span class="see-h">On this page</span>
59
- <ol>{sections.map((x) => <li><a href={`#${x.id}`}>{x.h}</a></li>)}</ol>
60
- </nav>
61
- )}
62
- {sections.map((x) => (
63
- <section class="prose body sec" id={x.id}>
64
- <h2>{x.h}</h2>
65
- {x.p.map((p) => <p set:html={md(p)} />)}
66
- {x.list && <ul>{x.list.map((li) => <li set:html={md(li)} />)}</ul>}
67
- </section>
68
- ))}
69
- {t.faq && t.faq.length > 0 && (
70
- <section class="prose body sec" id="faq">
71
- <h2>Questions people ask about {/^[A-Z]{2,}/.test(t.term) ? t.term : t.term.toLowerCase()}s</h2>
72
- {t.faq.map((f) => (
73
- <>
74
- <h3>{f.q}</h3>
75
- <p set:html={md(f.a)} />
76
- </>
77
- ))}
78
- </section>
83
+ {hasToc && (
84
+ <details class="toc-inline no-print" data-enter>
85
+ <summary>On this page<ChevronDown size={18} stroke-width={2} aria-hidden="true" /></summary>
86
+ <ol>{toc.map((x) => <li><a href={`#${x.id}`}>{x.h}</a></li>)}</ol>
87
+ </details>
79
88
  )}
80
- {t.updated && <p class="upd">Updated <time datetime={t.updated}>{new Date(t.updated).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}</time></p>}
89
+ <div class="prose body article-body" data-enter>
90
+ {t.body.map((p) => <p set:html={md(p)} />)}
91
+ {sections.map((x) => (
92
+ <section id={x.id}>
93
+ <h2 id={`${x.id}-h`}>{x.h}</h2>
94
+ {x.p.map((p) => <p set:html={md(p)} />)}
95
+ {x.list && <ul>{x.list.map((li) => <li set:html={md(li)} />)}</ul>}
96
+ </section>
97
+ ))}
98
+ {t.faq && t.faq.length > 0 && (
99
+ <section class="post-faq" id="faq" aria-labelledby="faq-h">
100
+ <h2 id="faq-h">Questions people ask about {/^[A-Z]{2,}/.test(t.term) ? t.term : t.term.toLowerCase()}s</h2>
101
+ {t.faq.map((f, i) => <details open={i === 0}><summary>{f.q}</summary><p set:html={md(f.a)} /></details>)}
102
+ </section>
103
+ )}
104
+ </div>
105
+
81
106
  {related.length > 0 && (
82
- <nav class="see" aria-label="Related terms" data-enter>
83
- <span class="see-h">Related terms</span>
84
- <ul>{related.map((r) => <li><a href={`/glossary/${r.slug}`}>{r.term}</a></li>)}</ul>
85
- </nav>
107
+ <section class="related-terms" aria-labelledby="rt-h">
108
+ <h2 id="rt-h">Related terms</h2>
109
+ <ul>
110
+ {related.map((r) => (
111
+ <li><a class="card" href={`/glossary/${r.slug}`}><span class="name">{r.term}</span><span class="short">{r.short}</span></a></li>
112
+ ))}
113
+ </ul>
114
+ </section>
86
115
  )}
116
+
117
+ <nav class="pn no-print" aria-label="Previous and next term">
118
+ {prev ? <a class="prev" href={`/glossary/${prev.slug}`} rel="prev"><ArrowLeft size={18} stroke-width={2} aria-hidden="true" /><span><small>Previous</small>{prev.term}</span></a> : <span></span>}
119
+ {next ? <a class="next" href={`/glossary/${next.slug}`} rel="next"><span><small>Next</small>{next.term}</span><ArrowRight size={18} stroke-width={2} aria-hidden="true" /></a> : <span></span>}
120
+ </nav>
87
121
  </div>
122
+ {hasToc && (
123
+ <aside class="rail no-print" aria-labelledby="rail-h">
124
+ <nav class="toc" aria-labelledby="rail-h">
125
+ <h2 id="rail-h">On this page</h2>
126
+ <ol>{toc.map((x) => <li><a href={`#${x.id}`} data-toc={`${x.id}-h`}>{x.h}</a></li>)}</ol>
127
+ </nav>
128
+ </aside>
129
+ )}
88
130
  </div>
89
131
  </article>
90
132
 
133
+ {guides.length > 0 && (
134
+ <section class="section-tight guides" aria-labelledby="g-h">
135
+ <div class="wrap">
136
+ <h2 id="g-h">Guides on this</h2>
137
+ <div class="cards">{guides.map((p) => <Story post={p} size="grid" />)}</div>
138
+ </div>
139
+ </section>
140
+ )}
141
+
91
142
  <Related groups={[
92
143
  { h: 'Where this matters', items: product ? [product] : [] },
93
- { h: 'Guides', items: guides.map((g) => ({ href: `/blog/${g.id}`, label: g.data.title })) },
94
144
  { h: 'More terms', items: glossary.filter((x) => x.slug !== t.slug && !t.related.includes(x.slug)).slice(0, 4).map((x) => ({ href: `/glossary/${x.slug}`, label: x.term })) },
95
145
  ]} />
96
146
  <CtaBand />
97
147
  </Base>
98
148
 
149
+ <script>
150
+ import { initArticle } from '../../lib/article-client';
151
+ initArticle();
152
+ </script>
153
+
99
154
  <style>
100
- .term { padding-block: var(--space-8) var(--space-9); }
101
- .col { max-width: 720px; }
102
- .back { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: var(--ink-muted); text-decoration: none; font-size: 16px; }
103
- .back:hover { color: var(--ink); }
104
- h1 { margin: var(--space-5) 0 var(--space-5); font-family: 'Source Serif 4 Variable', 'Serif Fallback', Georgia, serif; font-weight: 600; font-size: clamp(2rem, 1.5rem + 2vw, 3rem); line-height: 1.12; }
105
- /* The quotable one-line answer, set apart from the explanation. */
106
- .def { margin: 0 0 var(--space-6); padding: var(--space-5) var(--space-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); font-size: 1.1875rem; line-height: 1.5; }
155
+ .post :global(.title) { max-width: 24ch; font-family: var(--font-serif); }
156
+ .def { margin: 0 0 var(--space-6); padding: var(--space-5) var(--space-6); border-radius: var(--radius-panel); background: var(--surface); }
157
+ .def p { margin: 0 0 var(--space-3); font-size: 1.25rem; line-height: 1.5; }
107
158
  dfn { font-style: normal; font-weight: 600; }
108
- .body { max-width: none; font-family: 'Source Serif 4 Variable', 'Serif Fallback', Georgia, serif; font-size: 1.125rem; line-height: 1.5; }
109
- .body p { margin: 0 0 var(--space-4); }
110
- .toc { margin: var(--space-6) 0; padding: var(--space-5) var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-panel); }
111
- .toc ol { margin: var(--space-3) 0 0; padding-left: var(--space-5); font-size: 16px; line-height: 1.5; }
112
- .toc li { margin: var(--space-1) 0; }
113
- .toc a { color: var(--link); }
114
- .sec { margin-top: var(--space-7); scroll-margin-top: var(--space-8); }
115
- .sec h2 { margin: 0 0 var(--space-4); font-weight: 600; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); line-height: 1.12; }
116
- .sec h3 { margin: var(--space-5) 0 var(--space-2); font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
117
- .sec ul { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
118
- .sec li { margin: 0 0 var(--space-2); }
119
- .body a { color: var(--link); }
120
- .upd { margin-top: var(--space-6); font-size: 15px; color: var(--ink-muted); }
121
- .see { margin-top: var(--space-6); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
122
- .see-h { font-size: 15px; font-weight: 600; color: var(--ink-muted); }
123
- .see ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
124
- .see a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--ink); text-decoration: none; font-size: 15px; transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease); }
125
- .see a:hover { border-color: var(--brand); color: var(--link); }
159
+ .copy-def { padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--canvas); color: var(--ink-muted); font: inherit; font-size: 14px; cursor: pointer; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
160
+ .copy-def:hover { color: var(--link); border-color: var(--link); }
161
+
162
+ .related-terms { margin-top: var(--space-7); }
163
+ .related-terms h2, .guides h2 { margin: 0 0 var(--space-4); font-size: 1.375rem; }
164
+ .related-terms ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
165
+ .card { display: grid; gap: var(--space-1); height: 100%; padding: var(--space-4) var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-panel); color: var(--ink); text-decoration: none; transition: border-color var(--fast) var(--ease); }
166
+ .card:hover, .card:focus-visible { border-color: var(--brand); }
167
+ .name { font-family: var(--font-serif); font-size: 1.125rem; font-weight: 600; }
168
+ .short { font-size: 15px; line-height: 1.5; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
169
+
170
+ .pn { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); }
171
+ .pn a { display: inline-flex; align-items: center; gap: var(--space-3); min-height: 48px; color: var(--ink); text-decoration: none; font-weight: 600; }
172
+ .pn a:hover { color: var(--link); }
173
+ .pn small { display: block; font-size: 14px; font-weight: 400; color: var(--ink-muted); }
174
+ .pn .next { margin-left: auto; text-align: right; }
175
+
176
+ .cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6) var(--space-5); }
177
+ @media (max-width: 959px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
178
+ @media (max-width: 599px) { .related-terms ul, .cards { grid-template-columns: 1fr; } .def { padding: var(--space-4) var(--space-5); } }
126
179
  </style>
@@ -1,11 +1,21 @@
1
1
  ---
2
+ // The glossary front: a search box, optional topic chips, the in-depth guides
3
+ // first, then every term as a card under its letter. A sticky A-Z bar jumps to
4
+ // a letter. Without JavaScript the full list shows.
2
5
  import Base from '@site/layouts/Base.astro';
3
- import ArrowRight from '@lucide/astro/icons/arrow-right';
4
- import { glossary } from '../../lib/glossary';
6
+ import { glossary, type Term } from '../../lib/glossary';
5
7
  import { kit } from '../../config';
6
8
  import { breadcrumbJsonLd, definedTermSetJsonLd } from '../../lib/seo';
7
9
 
8
10
  const terms = [...glossary].sort((a, b) => a.term.localeCompare(b.term));
11
+ const letterOf = (t: Term) => (/^[A-Za-z]/.test(t.term) ? t.term[0].toUpperCase() : '#');
12
+ const groups = new Map<string, Term[]>();
13
+ for (const t of terms) groups.set(letterOf(t), [...(groups.get(letterOf(t)) ?? []), t]);
14
+ const alphabet = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '#'];
15
+ const guides = terms.filter((t) => t.sections?.length);
16
+ const topics = [...new Set(terms.map((t) => t.topic).filter((x): x is string => !!x))].sort();
17
+ const haystack = (t: Term) => [t.term, t.full, ...(t.aka ?? []), t.short].filter(Boolean).join(' ').toLowerCase();
18
+ const id = (l: string) => `letter-${l === '#' ? 'num' : l.toLowerCase()}`;
9
19
  ---
10
20
  <Base
11
21
  title={kit.glossary.indexTitle}
@@ -13,39 +23,142 @@ const terms = [...glossary].sort((a, b) => a.term.localeCompare(b.term));
13
23
  path="/glossary"
14
24
  jsonLd={[definedTermSetJsonLd(terms), breadcrumbJsonLd([{ name: 'Glossary', path: '/glossary' }])]}
15
25
  >
16
- <section class="section blog-serif">
26
+ <section class="section blog-serif front">
17
27
  <div class="wrap">
18
- <h1 data-enter>Glossary</h1>
19
- <ul class="terms">
20
- {terms.map((t, i) => (
21
- <li data-enter style={`--d:${Math.min(i + 1, 8)}`}>
22
- <a href={`/glossary/${t.slug}`}>
23
- <span class="name">{t.term}{t.full && <span class="full"> · {t.full}</span>}</span>
24
- <span class="short">{t.short}</span>
25
- <ArrowRight class="go" size={18} stroke-width={2} aria-hidden="true" />
26
- </a>
27
- </li>
28
- ))}
29
- </ul>
28
+ <h1 data-enter>{kit.glossary.heading ?? 'Glossary'}</h1>
29
+ <p class="count" data-enter><span data-count>{terms.length}</span> terms</p>
30
+ <div class="tools" data-enter>
31
+ <input class="search" type="search" placeholder="Search terms" aria-label="Search the glossary" autocomplete="off" data-search />
32
+ {topics.length > 0 && (
33
+ <div class="chips" role="group" aria-label="Topics">
34
+ <button type="button" class="chip" aria-pressed="true" data-topic="">All</button>
35
+ {topics.map((tp) => <button type="button" class="chip" aria-pressed="false" data-topic={tp}>{tp}</button>)}
36
+ </div>
37
+ )}
38
+ </div>
39
+
40
+ <nav class="az" aria-label="A to Z">
41
+ {alphabet.map((l) => groups.has(l)
42
+ ? <a href={`#${id(l)}`} data-az={l}>{l}</a>
43
+ : <span aria-hidden="true" data-az={l} class="off">{l}</span>)}
44
+ </nav>
45
+
46
+ {guides.length > 0 && (
47
+ <section class="guides" aria-labelledby="guides-h" data-guides>
48
+ <h2 id="guides-h" class="block-h">In-depth guides</h2>
49
+ <ul class="guide-grid">
50
+ {guides.map((t) => (
51
+ <li data-term data-q={haystack(t)} data-topic={t.topic ?? ''}>
52
+ <a class="card big" href={`/glossary/${t.slug}`}>
53
+ <span class="name">{t.term}</span>
54
+ {t.full && <span class="full">{t.full}</span>}
55
+ <span class="short">{t.short}</span>
56
+ </a>
57
+ </li>
58
+ ))}
59
+ </ul>
60
+ </section>
61
+ )}
62
+
63
+ {[...groups.entries()].map(([l, items]) => (
64
+ <section class="letter" id={id(l)} data-letter={l} aria-labelledby={`${id(l)}-h`}>
65
+ <h2 class="big-letter" id={`${id(l)}-h`}>{l}</h2>
66
+ <ul class="grid">
67
+ {items.map((t) => (
68
+ <li data-term data-q={haystack(t)} data-topic={t.topic ?? ''}>
69
+ <a class="card" href={`/glossary/${t.slug}`}>
70
+ <span class="name">{t.term}</span>
71
+ {t.full && <span class="full">{t.full}</span>}
72
+ <span class="short">{t.short}</span>
73
+ </a>
74
+ </li>
75
+ ))}
76
+ </ul>
77
+ </section>
78
+ ))}
79
+ <p class="none" hidden data-none>No terms match your search.</p>
30
80
  </div>
31
81
  </section>
32
82
  </Base>
33
83
 
84
+ <script>
85
+ const input = document.querySelector<HTMLInputElement>('[data-search]')!;
86
+ const count = document.querySelector<HTMLElement>('[data-count]')!;
87
+ const total = document.querySelectorAll('.letter [data-term]').length;
88
+ const items = [...document.querySelectorAll<HTMLElement>('[data-term]')];
89
+ const letters = [...document.querySelectorAll<HTMLElement>('.letter')];
90
+ const none = document.querySelector<HTMLElement>('[data-none]')!;
91
+ const guides = document.querySelector<HTMLElement>('[data-guides]');
92
+ const chips = [...document.querySelectorAll<HTMLButtonElement>('[data-topic][aria-pressed]')];
93
+ let topic = '';
94
+ const apply = () => {
95
+ const q = input.value.trim().toLowerCase();
96
+ items.forEach((li) => { li.hidden = !((!q || li.dataset.q!.includes(q)) && (!topic || li.dataset.topic === topic)); });
97
+ letters.forEach((s) => { s.hidden = ![...s.querySelectorAll('[data-term]')].some((li) => !(li as HTMLElement).hidden); });
98
+ if (guides) guides.hidden = ![...guides.querySelectorAll('[data-term]')].some((li) => !(li as HTMLElement).hidden);
99
+ const shown = document.querySelectorAll('.letter [data-term]:not([hidden])').length;
100
+ count.textContent = q || topic ? `${shown} of ${total}` : String(total);
101
+ none.hidden = shown > 0;
102
+ document.querySelectorAll<HTMLElement>('[data-az]').forEach((a) => {
103
+ const has = letters.some((s) => s.dataset.letter === a.dataset.az && !s.hidden);
104
+ a.classList.toggle('off', !has);
105
+ if (a instanceof HTMLAnchorElement) a.toggleAttribute('aria-disabled', !has);
106
+ });
107
+ };
108
+ input.addEventListener('input', apply);
109
+ chips.forEach((c) => c.addEventListener('click', () => {
110
+ topic = c.dataset.topic ?? '';
111
+ chips.forEach((o) => o.setAttribute('aria-pressed', String(o === c)));
112
+ apply();
113
+ }));
114
+ // The letter whose section is in view stays marked in the A-Z bar.
115
+ const azLinks = new Map([...document.querySelectorAll<HTMLAnchorElement>('a[data-az]')].map((a) => [a.dataset.az!, a]));
116
+ const seen = new Set<string>();
117
+ const io = new IntersectionObserver((entries) => {
118
+ entries.forEach((e) => { const l = (e.target as HTMLElement).dataset.letter!; if (e.isIntersecting) seen.add(l); else seen.delete(l); });
119
+ const first = letters.map((s) => s.dataset.letter!).find((l) => seen.has(l));
120
+ azLinks.forEach((a, l) => a.toggleAttribute('aria-current', l === first));
121
+ }, { rootMargin: '-140px 0px -60% 0px' });
122
+ letters.forEach((s) => io.observe(s));
123
+ </script>
124
+
34
125
  <style>
35
- h1 { margin-bottom: var(--space-7); }
36
- .terms { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
37
- .terms a {
38
- display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr) auto; gap: var(--space-6); align-items: baseline;
39
- padding: var(--space-5) 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none;
40
- }
41
- .name { font-family: 'Source Serif 4 Variable', 'Serif Fallback', Georgia, serif; font-size: 1.375rem; font-weight: 600; transition: color var(--fast) var(--ease); }
42
- .full { display: block; font-family: var(--font-sans); font-size: 14px; font-weight: 400; color: var(--ink-muted); margin-top: 2px; }
43
- .short { font-size: 16px; line-height: 1.5; color: var(--ink-muted); }
44
- .terms :global(.go) { color: var(--ink-muted); transition: transform var(--fast) var(--ease), color var(--fast) var(--ease); }
45
- .terms a:hover .name { color: var(--link); }
46
- .terms a:hover :global(.go) { transform: translateX(4px); color: var(--link); }
47
- @media (max-width: 767px) {
48
- .terms a { grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-4); }
49
- .short { grid-column: 1 / -1; grid-row: 2; }
50
- }
126
+ .front { padding-block: var(--space-7) var(--space-9); }
127
+ h1 { margin: 0 0 var(--space-2); font-size: clamp(2rem, 1.5rem + 2vw, 3rem); }
128
+ .count { margin: 0 0 var(--space-5); color: var(--ink-muted); }
129
+ .tools { display: grid; gap: var(--space-3); margin-bottom: var(--space-5); }
130
+ .search { width: 100%; max-width: 520px; min-height: 48px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--canvas); color: var(--ink); font: inherit; font-size: 16px; }
131
+ .search:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
132
+ .chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
133
+ .chip { min-height: 36px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-control); background: transparent; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease); }
134
+ .chip:hover { border-color: var(--brand); }
135
+ .chip[aria-pressed='true'] { background: var(--subtle); border-color: var(--brand); font-weight: 600; }
136
+
137
+ .az { position: sticky; top: 72px; z-index: 5; display: flex; flex-wrap: wrap; gap: 2px; margin: 0 calc(-1 * var(--gutter)) var(--space-6); padding: var(--space-2) var(--gutter); background: var(--canvas); border-bottom: 1px solid var(--line); }
138
+ .az a, .az span { display: inline-grid; place-items: center; min-width: 32px; height: 36px; border-radius: var(--radius-control); color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 15px; text-decoration: none; }
139
+ .az a:hover { background: var(--subtle); }
140
+ .az a[aria-current] { background: var(--ink); color: var(--canvas); }
141
+ .az .off { color: var(--ink-muted); opacity: 0.45; pointer-events: none; }
142
+
143
+ .block-h { margin: 0 0 var(--space-4); font-size: 1.375rem; }
144
+ .guides { margin-bottom: var(--space-8); scroll-margin-top: 140px; }
145
+ .guide-grid, .grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
146
+ .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
147
+ .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
148
+ .letter { margin-bottom: var(--space-7); scroll-margin-top: 140px; }
149
+ .big-letter { margin: 0 0 var(--space-4); font-size: 2.5rem; line-height: 1; }
150
+ [hidden] { display: none !important; }
151
+
152
+ .card { display: grid; align-content: start; gap: var(--space-1); height: 100%; padding: var(--space-4) var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-panel); color: var(--ink); text-decoration: none; transition: border-color var(--fast) var(--ease); }
153
+ .card:hover, .card:focus-visible { border-color: var(--brand); }
154
+ .card.big { padding: var(--space-5); }
155
+ .name { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; line-height: 1.25; }
156
+ .card.big .name { font-size: 1.5rem; }
157
+ .full { font-size: 14px; color: var(--ink-muted); }
158
+ .short { margin-top: var(--space-1); font-size: 15px; line-height: 1.5; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
159
+ .card.big .short { -webkit-line-clamp: 3; }
160
+ .none { color: var(--ink-muted); }
161
+
162
+ @media (max-width: 959px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
163
+ @media (max-width: 599px) { .grid, .guide-grid { grid-template-columns: 1fr; } .az { top: 64px; } }
51
164
  </style>
@@ -15,7 +15,7 @@ const BANNED_COPY = [
15
15
  [/social media chat|whatsapp|instagram|messenger|viber/i, 'social media chat is off the site'],
16
16
  [/world[- ]class|supercharg|seamless|effortless|\bunlock\b|\belevate\b|cutting[- ]edge|revolutioni[sz]e|game[- ]chang/i, 'generic marketing claim'],
17
17
  [/\bRs\.?\s?\d|NPR\s?\d|रु\s?\d/, 'price on the site'],
18
- [/lorem ipsum|TODO|TBD/i, 'placeholder text'],
18
+ [/lorem ipsum|\bTODO\b|\bTBD\b/i, 'placeholder text'],
19
19
  ];
20
20
  // Posts whose topic is the platforms themselves may name them.
21
21
  const PLATFORM_NAMES_ALLOWED = new Set(config.check?.platformNamesAllowed ?? []);
@@ -28,6 +28,14 @@ const BANNED_CSS = [
28
28
  [/text-transform\s*:\s*uppercase/, 'uppercase text'],
29
29
  [/cubic-bezier\([^)]*-|cubic-bezier\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*,\s*1\.\d/, 'bounce easing'],
30
30
  ];
31
+ // Visible text with a space at every block and cell boundary, so "1 TB" in one
32
+ // table cell and "Days" in the next do not read as "TBDays".
33
+ const BLOCKS = new Set(['P', 'DIV', 'LI', 'UL', 'OL', 'TR', 'TD', 'TH', 'TABLE', 'THEAD', 'TBODY', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'BR', 'SECTION', 'ARTICLE', 'ASIDE', 'HEADER', 'FOOTER', 'NAV', 'MAIN', 'FIGURE', 'FIGCAPTION', 'BLOCKQUOTE', 'DETAILS', 'SUMMARY', 'DT', 'DD', 'DL', 'PRE', 'LABEL', 'BUTTON']);
34
+ const spacedText = (node) => {
35
+ if (node.nodeType === 3) return node.rawText;
36
+ const inner = (node.childNodes ?? []).map(spacedText).join('');
37
+ return BLOCKS.has(node.rawTagName?.toUpperCase()) ? ` ${inner} ` : inner;
38
+ };
31
39
  const SECRET = /sk_[A-Za-z0-9]{20,}|ELEVENLABS_API_KEY/;
32
40
 
33
41
  export function canonicalFor(path) {
@@ -162,15 +170,15 @@ export function audit(dist, { designColours = DESIGN_COLOURS } = {}) {
162
170
  // Copy checks run on visible text only.
163
171
  for (const bad of root.querySelectorAll('script, style, noscript, template')) bad.remove();
164
172
  const body = root.querySelector('body') ?? root;
165
- const text = body.text.replace(/\s+/g, ' ');
173
+ const text = spacedText(body).replace(/\s+/g, ' ');
166
174
  // Call transcripts quote callers' own words, including a shop's prices.
167
175
  for (const t of body.querySelectorAll('[data-transcript]')) t.remove();
168
176
  // Published prices live only inside [data-prices] (the pricing page).
169
177
  for (const t of body.querySelectorAll('[data-prices]')) t.remove();
170
- const ownText = body.text.replace(/\s+/g, ' ');
178
+ const ownText = spacedText(body).replace(/\s+/g, ' ');
171
179
  // Legal pages describe the whole service, including app channels.
172
180
  for (const t of body.querySelectorAll('[data-legal]')) t.remove();
173
- const marketingText = body.text.replace(/\s+/g, ' ');
181
+ const marketingText = spacedText(body).replace(/\s+/g, ' ');
174
182
  // Blog posts may quote sourced market prices (owner, 2026-10-19).
175
183
  const isPost = /^blog\/[^/]+\.html$/.test(relative(dist, file)) && !/^blog\/(index|page|tag)/.test(relative(dist, file));
176
184
  for (const [re, what] of BANNED_COPY) {
@@ -0,0 +1,48 @@
1
+ /* Reading layout shared by the blog post and the glossary term page: breadcrumbs,
2
+ title and meta line, one text column (about 68 characters a line) and, on wide
3
+ screens, a sticky "On this page" rail. Phones get the same order with a
4
+ tap-to-open contents list. */
5
+ .post { padding-block: var(--space-6) var(--space-9); }
6
+ /* Breadcrumb trail: section and topic, the title follows as the heading. */
7
+ .post .crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); list-style: none; margin: 0; padding: 0; font-size: 14px; }
8
+ .post .crumbs li { display: inline-flex; align-items: center; gap: var(--space-2); }
9
+ .post .crumbs li + li::before { content: '›'; color: var(--ink-muted); }
10
+ .post .crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-muted); text-decoration: none; }
11
+ .post .crumbs a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
12
+ .post .crumbs li:last-child a { color: var(--link); font-weight: 500; }
13
+ .post .title { margin: var(--space-4) 0 var(--space-3); max-width: 26ch; font-weight: 600; font-size: clamp(1.875rem, 1.3rem + 2.4vw, 3.25rem); line-height: 1.12; text-wrap: balance; overflow-wrap: anywhere; }
14
+ .post .meta { margin: 0 0 var(--space-6); font-size: 15px; color: var(--ink-muted); }
15
+ .post .draft { color: var(--error); }
16
+
17
+ .post .grid { display: grid; grid-template-columns: minmax(0, 680px) 240px; justify-content: space-between; gap: var(--space-9); }
18
+ .post .col { min-width: 0; }
19
+
20
+
21
+ /* Contents on the right, sticky, current section in ink. */
22
+ .post .rail { position: relative; }
23
+ .post .toc { position: sticky; top: 104px; max-height: calc(100vh - 128px); overflow-y: auto; }
24
+ .post .toc h2, .post .toc-inline summary { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 var(--space-3); }
25
+ .post .toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
26
+ .post .toc a { display: block; margin-left: -1px; padding: 7px 0 7px var(--space-4); border-left: 2px solid transparent; color: var(--ink-muted); font-size: 14px; line-height: 1.45; text-decoration: none; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
27
+ .post .toc a:hover { color: var(--ink); }
28
+ .post .toc a[aria-current] { color: var(--ink); font-weight: 500; border-left-color: var(--mark); }
29
+
30
+ /* Tablet and phone: no rail; contents fold into a list under the takeaways. */
31
+ .post .toc-inline { display: none; margin: 0 0 var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-panel); }
32
+ .post .toc-inline summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin: 0; padding: 0 var(--space-4); cursor: pointer; list-style: none; }
33
+ .post .toc-inline summary::-webkit-details-marker { display: none; }
34
+ .post .toc-inline summary svg { transition: transform var(--fast) var(--ease); }
35
+ .post .toc-inline[open] summary svg { transform: rotate(180deg); }
36
+ .post .toc-inline ol { list-style: none; margin: 0; padding: 0 var(--space-4) var(--space-2); }
37
+ .post .toc-inline li + li { border-top: 1px solid var(--line); }
38
+ .post .toc-inline a { display: flex; align-items: center; min-height: 44px; padding-block: var(--space-2); color: var(--ink); font-size: 15px; line-height: 1.4; text-decoration: none; }
39
+ .post .toc-inline a:hover { color: var(--link); }
40
+
41
+ @media (max-width: 1099px) {
42
+ .post .grid { grid-template-columns: minmax(0, 680px); gap: 0; }
43
+ .post .rail { display: none; }
44
+ .post .toc-inline { display: block; }
45
+ }
46
+ @media (max-width: 599px) {
47
+ .post { padding-top: var(--space-4); }
48
+ }
@@ -0,0 +1,95 @@
1
+ /* Article body: the reading text of a blog post (and, later, a glossary term).
2
+ Flat: no shadows or gradients. Colours, fonts and radii come from the site's
3
+ tokens: --canvas --surface --subtle --line --ink --ink-muted --link
4
+ --mark (accent for markers and the progress bar) --warn-bg --warn-ink
5
+ --font-sans --font-display --font-mono --radius-panel. */
6
+
7
+ .prose.article-body { max-width: none; font-size: 1.0625rem; line-height: 1.7; }
8
+ .prose.article-body p, .prose.article-body ul, .prose.article-body ol { margin: 0 0 1.1em; }
9
+ .prose.article-body li + li { margin-top: 0.35em; }
10
+ .prose.article-body h2 { position: relative; font-weight: 600; font-size: 1.5rem; line-height: 1.25; margin: 1.8em 0 0.6em; scroll-margin-top: 104px; }
11
+ .prose.article-body h3 { font-weight: 600; font-size: 1.1875rem; line-height: 1.3; margin: 1.5em 0 0.4em; scroll-margin-top: 104px; }
12
+
13
+ /* A small "#" beside a heading that copies its link; shown on hover and focus. */
14
+ .prose.article-body .anchor { margin-left: 0.4em; color: var(--ink-muted); font-size: 0.8em; font-weight: 400; text-decoration: none; opacity: 0; transition: opacity var(--fast) var(--ease); }
15
+ .prose.article-body h2:hover .anchor, .prose.article-body .anchor:focus-visible { opacity: 1; }
16
+ .prose.article-body .anchor:hover { color: var(--link); }
17
+ @media (hover: none) { .prose.article-body .anchor { display: none; } }
18
+
19
+ /* Bullets take the accent; numbered lists become steps in circles. */
20
+ .prose.article-body ul > li::marker { color: var(--mark); }
21
+ .prose.article-body ol { list-style: none; padding-left: 0; counter-reset: step; }
22
+ .prose.article-body ol > li { position: relative; padding-left: 44px; min-height: 28px; counter-increment: step; }
23
+ .prose.article-body ol > li + li { margin-top: 0.6em; }
24
+ .prose.article-body ol > li::before { content: counter(step); position: absolute; left: 0; top: 0.1em; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--subtle); color: var(--link); font-family: var(--font-display); font-size: 0.875rem; font-weight: 600; line-height: 1; }
25
+
26
+ /* Quotes: larger text and a quote mark, no stripe. */
27
+ .prose.article-body blockquote { position: relative; margin: 1.6em 0; padding: 1.4em 0 0; border: 0; color: var(--ink); font-size: 1.25rem; line-height: 1.5; }
28
+ .prose.article-body blockquote::before { content: '\201C'; position: absolute; top: -0.15em; left: 0; color: var(--ink-muted); font-family: var(--font-display); font-size: 3rem; line-height: 1; }
29
+ .prose.article-body blockquote p { margin: 0 0 0.6em; }
30
+
31
+ /* Callouts from > [!NOTE], [!TIP], [!WARNING] and [!STAT]. */
32
+ .prose.article-body .callout { margin: 1.6em 0; padding: 18px 20px; border-radius: var(--radius-panel); background: var(--surface); color: var(--ink); }
33
+ .prose.article-body .callout > :last-child { margin-bottom: 0; }
34
+ .prose.article-body .callout-title { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2); font-family: var(--font-display); font-weight: 600; }
35
+ .prose.article-body .callout-title svg { flex: none; }
36
+ .prose.article-body .callout-warning { background: var(--warn-bg); color: var(--warn-ink); }
37
+ .prose.article-body .callout-warning .callout-title, .prose.article-body .callout-warning a { color: var(--warn-ink); }
38
+ .prose.article-body .callout-stat .stat-number { margin: 0; font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.15; }
39
+ .prose.article-body .callout-stat .stat-caption { margin-top: var(--space-1); font-size: 15px; line-height: 1.5; color: var(--ink-muted); }
40
+ .prose.article-body .callout-stat .stat-caption p { margin: 0; }
41
+
42
+ /* Tables: a bordered box that scrolls sideways, a header and first column that stay in view. */
43
+ .prose.article-body .table-scroll { overflow-x: auto; margin: 1.6em 0; border: 1px solid var(--line); border-radius: var(--radius-panel); }
44
+ .prose.article-body table { width: 100%; border-collapse: separate; border-spacing: 0; font-family: var(--font-sans); font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; }
45
+ .prose.article-body th, .prose.article-body td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
46
+ .prose.article-body th { position: sticky; top: 0; z-index: 1; background: var(--surface); color: var(--ink); font-weight: 600; }
47
+ .prose.article-body td { background: var(--canvas); }
48
+ .prose.article-body tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface) 50%, var(--canvas)); }
49
+ .prose.article-body tbody tr:hover td { background: var(--subtle); }
50
+ .prose.article-body tbody tr:last-child td { border-bottom: 0; }
51
+ .prose.article-body th:first-child, .prose.article-body td:first-child { position: sticky; left: 0; }
52
+ .prose.article-body th:first-child { z-index: 2; }
53
+ .prose.article-body td:first-child { font-weight: 500; }
54
+ .prose.article-body th.num, .prose.article-body td.num { text-align: right; white-space: nowrap; }
55
+ .prose.article-body td a, .prose.article-body th a { color: var(--link); }
56
+
57
+ /* Figures: on wide screens they reach into the contents rail's space. */
58
+ .prose.article-body figure { margin: 1.6em 0; }
59
+ .prose.article-body figure img, .prose.article-body img { display: block; width: 100%; height: auto; margin: 0; border-radius: var(--radius-panel); background: var(--surface); }
60
+ .prose.article-body figcaption { margin-top: var(--space-2); font-size: 14px; line-height: 1.45; color: var(--ink-muted); }
61
+ @media (min-width: 1100px) {
62
+ .prose.article-body figure { width: min(900px, calc(100% + 220px)); max-width: none; }
63
+ }
64
+
65
+ /* Questions people ask: an accordion, first answer open. */
66
+ .post-faq { margin-top: var(--space-7); }
67
+ .post-faq > h2 { margin-bottom: var(--space-3); }
68
+ .post-faq details { border-bottom: 1px solid var(--line); }
69
+ .post-faq details:first-of-type { border-top: 1px solid var(--line); }
70
+ .post-faq summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 48px; padding: var(--space-3) 0; cursor: pointer; list-style: none; font-family: var(--font-display); font-size: 1.0625rem; font-weight: 600; line-height: 1.35; }
71
+ .post-faq summary::-webkit-details-marker { display: none; }
72
+ .post-faq summary::after { content: '+'; flex: none; color: var(--link); font-size: 1.5rem; font-weight: 400; line-height: 1; transition: transform var(--fast) var(--ease); }
73
+ .post-faq details[open] summary::after { transform: rotate(45deg); }
74
+ .post-faq summary:hover { color: var(--link); }
75
+ .post-faq details p { margin: 0 0 var(--space-4); max-width: 62ch; }
76
+
77
+ /* Reading progress: a thin bar at the top of the page, moved with a transform. */
78
+ .read-progress { position: fixed; inset: 0 0 auto 0; z-index: 60; height: 3px; pointer-events: none; }
79
+ .read-progress i { display: block; height: 100%; background: var(--mark); transform: scaleX(var(--p, 0)); transform-origin: left; }
80
+ @media (prefers-reduced-motion: reduce) { .read-progress { display: none; } }
81
+ @media print { .read-progress, .copy-link { display: none; } }
82
+
83
+ /* "Copy link" beside the date line. */
84
+ .copy-link { margin-left: var(--space-2); padding: 2px 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: transparent; color: var(--ink-muted); font: inherit; font-size: 14px; cursor: pointer; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
85
+ .copy-link:hover { color: var(--link); border-color: var(--link); }
86
+
87
+ @media (max-width: 599px) {
88
+ .prose.article-body { font-size: 1rem; line-height: 1.7; }
89
+ .prose.article-body h2 { font-size: 1.3125rem; }
90
+ .prose.article-body table { font-size: 14px; }
91
+ .prose.article-body th, .prose.article-body td { padding: 8px 12px; }
92
+ .prose.article-body figure { margin: 1.4em calc(-1 * var(--gutter)); }
93
+ .prose.article-body figure img { border-radius: 0; }
94
+ .prose.article-body figcaption { padding-inline: var(--gutter); }
95
+ }
@@ -1,2 +1,2 @@
1
1
  /* Blog: headings and post titles in the reading serif. */
2
- .blog-serif h1, .blog-serif h2, .blog-serif h3 { font-family: 'Source Serif 4 Variable', 'Serif Fallback', Georgia, serif; font-weight: 600; }
2
+ .blog-serif h1, .blog-serif h2, .blog-serif h3 { font-family: var(--font-serif); font-weight: 600; }